package org.uu.util;

import java.io.IOException;
import java.io.RandomAccessFile;

public class FileReadUtil {

    public static String readFile(String filePath) {
        StringBuffer sb = new StringBuffer("");
        try {
            RandomAccessFile file = new RandomAccessFile(filePath,"r");

            String line = "";
            do {
                line = file.readLine();
//                System.out.println(line);
                if (line.contains("BEGIN") || line.contains("END")) {
                    continue;
                }
                sb.append(line);
            }while (!line.contains("-----END"));

        } catch (IOException e) {
            e.printStackTrace();
        }
        return sb.toString();
    }

    public static void main(String[] args) {
        String s = readFile("D:\\devpdir\\debug\\java-jwt\\src\\main\\resources\\rsa256_private.key");
        System.out.println(s);
    }
}
